package allaboutmybook;



import java.awt.List;
import java.util.Collection;
import java.util.LinkedList;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
@Table(name="TOPICOS_DE_FORUM")
public class TopicoDeForum 
{
	@Id
	@Column(name="TITULO_TOPICO_DE_FORUM")
	private String tituloTopicodeForum;
	
	@Column(name="DESCRICAO_TOPICO_DE_FORUM")
	private String descricaoTopicoDeForum;
	
	@OneToMany(mappedBy="topicoDeForum", fetch=FetchType.EAGER)
	@Cascade(CascadeType.ALL)
	private Collection<ComentarioDeForum> comentariosDoTopicoDeForum;
	
	public TopicoDeForum()
	{
		comentariosDoTopicoDeForum = new LinkedList<ComentarioDeForum>();
	}
	
	
	
	public String getTituloTopicodeForum() {
		return tituloTopicodeForum;
	}
	public void setTituloTopicodeForum(String tituloTopicodeForum) {
		this.tituloTopicodeForum = tituloTopicodeForum;
	}
	public String getDescricaoTopicoDeForum() {
		return descricaoTopicoDeForum;
	}
	public void setDescricaoTopicoDeForum(String descricaoTopicoDeForum) {
		this.descricaoTopicoDeForum = descricaoTopicoDeForum;
	}
	
	public Collection getComentariosDoTopicoDeForum()
	{
		return this.comentariosDoTopicoDeForum;
	}
	
	public void adicionarComentarioTopicoDeForum(ComentarioDeForum novo)
	{
		this.comentariosDoTopicoDeForum.add(novo);
	}



	public void setComentariosDoTopicoDeForum(Collection comentariosDoTopicoDeForum) {
		this.comentariosDoTopicoDeForum = comentariosDoTopicoDeForum;
	}
	
	

}
